package com.yanqu.road.server.cmd.yrank.user;

import com.yanqu.road.logic.pb.YRankPb;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.rank.YRankProto;
import com.yanqu.road.server.cmd.CrossUnionCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.manager.yrank.CrossYRankMgr;
import com.yanqu.road.server.protocol.CrossProtocol;

@Cmd(code = CrossProtocol.C2_CROSS_YRANK_UPLOAD_USER_RANK, desc = "")
public class CrossYRankUploadUserRankCmd extends CrossUnionCommand {

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        YRankProto.UserYRankListMsg listMsg = YRankProto.UserYRankListMsg.parseFrom(packet.getBytes());
        for (YRankProto.UserYRankMsg userYRankMsg : listMsg.getRankListList()) {
            CrossYRankMgr.userRankChange(YRankPb.parseUserYRank(listMsg.getActivityId(), listMsg.getGroupId(), listMsg.getIdKey(), userYRankMsg));
        }
    }

    @Override
    public void sendData() {

    }
}
